<template>
  <el-dialog :visible="recordsVisible"
             title="温湿度阀值记录"
             width="800px"
             :before-close="handleClose">
    <div class="records">
      <el-timeline :reverse="reverse">
        <el-timeline-item v-for="(item, index) in value"
                          :key="index"
                          :timestamp="item.timestamp"
                          class="con-left">
          <div class="date width">
            <span>{{item.date}}</span>
          </div>
          <!-- <div class="cont width">{{item.content}}</div> -->
        </el-timeline-item>
      </el-timeline>
      <div v-show="!value.length"
           class="empty">暂无数据</div>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: "Record",
  props: {
    recordsVisible: Boolean,
    value: {
      type: Array,
      default: () => []
    }
  },
  data () {
    return {
      reverse: false,
    }
  },
  methods: {
    // 关闭当前弹窗
    handleClose () {
      this.$emit('close')
    }
  }
}
</script>

<style scoped>
.records {
  padding: 10px 0px 0px 30px;
  margin: 10px 0px;
  max-height: 400px;
  overflow-y: auto;
}
.records >>> .el-timeline-item__wrapper {
  top: -12px;
}
.records >>> .el-timeline-item__node {
  background-color: #ffdbc4;
}
.date {
  color: var(--prev-color-text-black);
  font-size: 16px;
  line-height: 23px;
}
.cont {
  white-space: normal;
  text-overflow: ellipsis;
  color: #686868;
  font-size: 14px;
  line-height: 20px;
}
.width {
  width: 95% !important;
  word-break: break-all;
}
.empty {
  /* height: 400px;
  line-height: 400px; */
  margin: 10px 0px;
  text-align: center;
  font-size: 16px;
}
</style>